#include <stdio.h>
#include <math.h>
void sort(int n,int nums[]){
    for (size_t i = 0; i < n; i++)
    {
        for (size_t z = i+1; z < n; z++)
        {
            int temp = 0;
            if(abs(nums[i])<abs(nums[z])){
                temp = nums[z];
                nums[z] = nums[i];
                nums[i] = temp;
            }
        }
    }

    for (size_t i = 0; i < n; i++)
    {
        printf("%d ", nums[i]);
    }
}


int main(int argc, char *argv[]) {
    int n = 0;
    while (scanf("%d",&n)!=EOF)
    {
        if(n==0) break;
        int nums[n];
        for (size_t i = 0; i < n; i++)
        {
            scanf("%d", &nums[i]);
        }

        //排序输出
        sort(n, nums);
    }
    


    return 0;
}
